package com.yjs.app.trade.service.service.util;

import java.util.HashMap;
import java.util.Map;

public class TokenThreadLocal {
	
	private static final ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<Map<String, Object>>(){
		@Override
		protected Map<String, Object> initialValue() {
			return new HashMap<String, Object>();
		}
	};
	
	public static void setValue (String key, Object value) {
		if (threadLocal.get() != null) {
			threadLocal.get().put(key, value);
		}
	}
	
	public static Object getValue (String key) {
		if (threadLocal.get() != null) {
			return threadLocal.get().get(key);
		} else {
			return null;
		}
	}
	
	public static void remove (String key) {
		if (threadLocal.get() != null) {
			threadLocal.get().remove(key);
		}
	}
}	
